#cloud-config


coreos:
  units:
    - name: coreos-bootstrap.service
      runtime: no
      command: start
      content: |
        [Unit]
        Description=Install coreos to disk
        [Service]
        Type=oneshot
        ExecStart=/usr/bin/coreos-install \
          -C  \
          -V 7 \
          -d /dev/sda  \
          -c /home/core/cloud-config.yml 
        ExecStartPost=/usr/bin/wget -q -O /dev/null --no-check-certificate http://foreman.some.host.fqdn/unattended/built
        ExecStartPost=/usr/sbin/reboot
        [X-Fleet]
        X-Conflicts=coreos-bootstrap.service
users:
  - name: core
    passwd: xybxa6JUkz63w
write_files:
  - content: |
      #cloud-config

      coreos:
        etcd2:
          advertise-client-urls: http://127.0.0.1:2379
          initial-advertise-peer-urls: http://127.0.0.1:2380
          listen-client-urls: http://0.0.0.0:2379
          listen-peer-urls: http://0.0.0.0:2380
        units:
          - name: etcd2.service
            command: start
          - name: fleet.service
            command: start
      hostname: snapshothost
      users:
        - name: core
          passwd: xybxa6JUkz63w

    path: /home/core/cloud-config.yml
    permissions: '0600'
    owner: core:core
